#include "MapFunctions.h"
#include "ObjMeshManager.h"
#include "DX11ErrorReport.h"

void CheckMapElement(TextureMap& map, const std::wstring& tag)
{
	TextureMap::iterator it = map.find(tag);

	if(it == map.end())
	{
		std::wstring errorMsg;
		errorMsg.assign(tag.begin(), tag.end());
		errorMsg = L"No such item: " + errorMsg;
		DX11ErrorMsg(errorMsg.c_str(), L"CheckMapElement", MB_YESNO);
	}
}

void CheckMapElement(std::map<std::string, ObjMesh*>& map, const std::string& tag)
{
	std::map<std::string, ObjMesh*>::iterator it = map.find(tag);

	if(it == map.end())
	{
		std::wstring errorMsg;
		errorMsg.assign(tag.begin(), tag.end());
		errorMsg = L"No such mesh: " + errorMsg;
		DX11ErrorMsg(errorMsg.c_str(), L"ObjMeshManager", MB_YESNO);
	}
}

void CheckMapElement(std::map<std::string, Font*>& map, const std::string& tag)
{
	std::map<std::string, Font*>::iterator it = map.find(tag);

	if(it == map.end())
	{
		std::wstring errorMsg;
		errorMsg.assign(tag.begin(), tag.end());
		errorMsg = L"No such mesh: " + errorMsg;
		DX11ErrorMsg(errorMsg.c_str(), L"ObjMeshManager", MB_YESNO);
	}
}